#include "KeyboardEvent.h"

EKeyState SKeyboardEvent::KeyStates[(int64_t)EKey::MaxKey]={EKeyState::Released};

bool SKeyboardEvent::IsKeyPressed(EKey Key)
{
    return KeyStates[(int64_t)Key]==EKeyState::Pressed;
}

bool SKeyboardEvent::IsAnyAltDown()
{
    return KeyStates[(int64_t)EKey::LAlt]==EKeyState::Pressed ||
        KeyStates[(int64_t)EKey::RAlt]==EKeyState::Pressed;
}

bool SKeyboardEvent::IsAnyCtrlDown()
{
    return KeyStates[(int64_t)EKey::LControl]==EKeyState::Pressed ||
        KeyStates[(int64_t)EKey::RControl]==EKeyState::Pressed;
}

bool SKeyboardEvent::IsAnyShiftDown()
{
    return KeyStates[(int64_t)EKey::LShift]==EKeyState::Pressed ||
        KeyStates[(int64_t)EKey::RShift]==EKeyState::Pressed;
}

bool SKeyboardEvent::IsAnySystemDown()
{
    return KeyStates[(int64_t)EKey::LSystem]==EKeyState::Pressed ||
        KeyStates[(int64_t)EKey::RSystem]==EKeyState::Pressed;
}

void SKeyboardEvent::SetGlobalKeyState(EKey Key, EKeyState KeyState)
{
    KeyStates[(int64_t)Key]=KeyState;
}
